<?php defined('APP_PATH') or exit('Access Denied');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加广告</title>
<link rel="stylesheet" type="text/css" href="vonuo/static/css/vonuo.css">
<script type="text/javascript" src="vonuo/static/js/jquery.min.js"></script>
<script type="text/javascript">
//打开弹窗
function selectPic(formNum,needThumb,callThumb){
	var upurl = '/admin.php?c=upld&a=img&needthumb='+needThumb+'&callthumb='+callThumb+'&formnum='+formNum+'&random='+Math.random();
	$("#zhezhao").css('width',$(document).width());
	$("#zhezhao").css('height',$(document).height());
	$("iframe#upimgframe").attr('src', upurl);
	$("#zhezhao").show();
	$("#uppic").show();
}
//关闭弹窗
function cancelSel(){
	$("#uppic").hide();
	$("#zhezhao").hide();
}
//上传成功后调用
function upsuc(formNum, saveUrl){
	$("#slturl_"+formNum).val(saveUrl);
	$("#uppic").hide();
	$("#zhezhao").hide();
}
function check(){
	if($.trim($("input[name='name']").val()) == ''){
		$("#need_name").html("<strong style='color:red;'>请输入广告名称！</strong>");
		$("input[name='name']").focus();
		return false;
	}else{
		$("#need_name").html("<strong style='color:red;'>√</strong>");
	}
	if($.trim($("input[name='thumb']").val()) == ''){
		$("#need_thumb").html("<strong style='color:red;'>请上传广告图片！</strong>");
		$("input[name='thumb']").focus();
		return false;
	}else{
		$("#need_thumb").html("<strong style='color:red;'>√</strong>");
	}
	if($.trim($("input[name='url']").val()) == ''){
		$("#need_url").html("<strong style='color:red;'>请输入跳转网址！</strong>");
		$("input[name='url']").focus();
		return false;
	}else{
		$("#need_url").html("<strong style='color:red;'>√</strong>");
	}
	return true;
}
</script>
</head>

<body>
<div class="gs_wraper gs_p_l0">
	<div class="title">
		<a href="<?php echo spUrl('myad','lis');?>">广告列表</a>
		<a href="javascript:;" class="hover">添加广告</a>
	</div>
	<form action="<?php echo spUrl('myad','doadd');?>" method="post">
	<div class="tab_box" id="con_one_1">
		<table border="0" cellspacing="0" cellpadding="0" class="table_btm">
			<tr>
				<td class="txt_right txt_s_blue">名称：</td>
				<td>
					<input name="name" type="text" class="blue_input input_w_175" />
					<span id="need_name"></span>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">排序：</td>
				<td><input name="odnum" value="0" type="text" class="blue_input input_w_175" /></td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">图片：</td>
				<td>
					<input name="thumb" id="slturl_1" type="text" readonly class="blue_input input_w_175 f_left" />
					<a href="javascript:;" onclick="selectPic(1,'no','no');" class="btn_wei f_left">浏览</a> 
					<span id="need_thumb"></span>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue">网址：</td>
				<td>
					<input name="url" type="text" class="blue_input input_w_250 f_left"  />
					<span id="need_url"></span>
				</td>
			</tr>
			<tr>
				<td class="txt_right txt_s_blue" valign="top">描述：</td>
				<td><textarea name="info" cols="40" rows="4" class="blue_textarea"></textarea></td>
			</tr>
			<tr>
				<td><input type="hidden" name="time" value="<?php echo time();?>" /></td>
				<td><a href="javascript:;" onclick="if(check()){$('form').submit();}" class="sure_submit f_left time">确 定</a><a href="<?php echo spUrl('myad','lis');?>" class="return_btn f_left">返 回</a></td>
			</tr>
		</table>
	</div>
	</form>
<!-- 上传图片 -->
<div id="uppic" style="position:fixed;left:400px;top:180px;z-index:999;display:none;">
	<a href="javascript:;" onclick="cancelSel();" title="关闭" class="f_right f_14 f_weight closeBtn">×</a>
	<iframe id="upimgframe" src="" width="325" height="130" frameborder="no" scrolling="no"></iframe>
</div>
<div id="zhezhao" class="zhezhao"></div>
</div>
</body>
</html>